{extend name='index/base' /}

{block name='main'}
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 会员管理 <span class="c-gray en">&gt;</span> 企业会员 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="text-c">
        <!--<form id="myform" action="{:url('Vip/index')}" method="get">-->

        <!--代理商名称：<input type="text" id="name" class="input-text" style="width:120px" placeholder="代理商名称" value="" name="name">-->
            <!--<input id="pc" type="hidden" name="p" value="">-->

        <!--<button type="submit" class="btn btn-success radius"  name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>-->
        <!--<button type="button" id="reset" class="btn btn-danger radius" > 重置</button>-->
        <!--</form>-->
    </div>

    <div class="mt-20">
        <div class="dataTables_length mb-15" id="DataTables_Table_0_length">

        </div>
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th width="100">姓名</th>
                <th width="150">期货账户</th>
                <th width="150">手机号</th>
                <th width="130">创建时间</th>
                <th width="130">认证状态</th>
                <th width="130">操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name='list' id='user'}
            <tr class="text-c">
                <td style="text-align: left"><a href="javascript:;">{$user.name}</a></td>
                <td>{$user.assetaccount}</td>
                <td>{$user.phonenumber}</td>
                <td>{$user.creationtime}</td>
                <td>
                    {if condition="$user.RNA == 1"} <strong style="color: green;font-weight: 900">✔</strong>
                    {elseif condition="$user.RNA == 2"/} <strong style="color: yellow;font-weight: 900">▬</strong>
                    {else /} <strong style="color: red;font-weight: 900">✘</strong>
                    {/if}</td>
                </td>
                <td><div class="tpl-table-black-operation">
                    <a href="javascript:;" onclick="show({$user.id})"  class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
                        查看信息
                    </a>
                    </div>
                </td>


            </tr>
            {/volist}
            </tbody>
        </table>
        {$page}
    </div>
</div>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" style="margin-top: 15%;" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel"></h4>
            </div>
            <div class="modal-body">
                <h5 id="dqqy"></h5>
                <h5 id="kyzj"></h5>
                <h5 id="bzj"></h5>
                <h5 id="yxzj"></h5>
                <h5 id="lhzj"></h5>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <!--<button type="button" class="btn btn-primary">Save changes</button>-->
            </div>
        </div>
    </div>
</div>


</body>
</html>

{/block}


{block name='my'}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<!--<script type="text/javascript" src="/static/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>-->
<script type="text/javascript" src="/static/admin/lib/laypage/1.2/laypage.js"></script>
<script>
    function show($id) {
        console.log($id);
        $.ajax({
            type:'get',
            url:'/vip_agent/Vip/show?id='+$id,
            dataType:'json',
            success:function (data) {
                if(data.status==2){
                    $('#myModalLabel').html('用户 '+data.name+' 的信息：');
                    $('#dqqy').html('当前权益：'+'查询错误');
                    $('#kyzj').html('可用资金：'+'查询错误');
                    $('#bzj').html('保证金：'+'查询错误');
                    $('#yxzj').html('优先资金：'+'查询错误');
                    $('#lhzj').html('劣后资金：'+'查询错误');
                    alert(data.msg);
                }else{
                    $('#myModalLabel').html('用户 '+data.name+' 的信息：');
                    $('#dqqy').html('当前权益：'+data.res.Balance);
                    $('#kyzj').html('可用资金：'+data.res.Available);
                    $('#bzj').html('保证金：'+data.res.Margin);
                    $('#yxzj').html('优先资金：'+data.res.Credit);
                    var dqqy=data.res.Balance-data.res.Credit;
                    $('#lhzj').html('劣后资金：'+dqqy);
                }
            },
            error:function () {
                console.log(222);
            }
        })
    }

</script>
<script type="text/javascript">
    $(function(){
//        $('.table-sort').dataTable({
//            "aaSorting": [[ 1, "desc" ]],//默认第几个排序
//            "bStateSave": true,//状态保存
//            "aoColumnDefs": [
//                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
//                {"orderable":false,"aTargets":[]}// 制定列不参与排序
//            ]
//        });

    });
    /*用户-添加*/
    function addvip(title,url,w,h){
        layer_show(title,url,w,h);
    }
    /*用户-查看*/
    function member_show(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    /*用户-停用*/
    function member_stop(obj,id){
        layer.confirm('确认要停用吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '',
                dataType: 'json',
                success: function(data){
                    $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_start(this,id)" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe6e1;</i></a>');
                    $(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已停用</span>');
                    $(obj).remove();
                    layer.msg('已停用!',{icon: 5,time:1000});
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }

    /*用户-启用*/
    function member_start(obj,id){
        layer.confirm('确认要启用吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '',
                dataType: 'json',
                success: function(data){
                    $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_stop(this,id)" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>');
                    $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
                    $(obj).remove();
                    layer.msg('已启用!',{icon: 6,time:1000});
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
    /*用户-编辑*/
    function member_edit(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    /*密码-修改*/
    function change_password(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    /*用户-删除*/
    function member_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '',
                dataType: 'json',
                success: function(data){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
    $('#p').change(function () {
        var c=$(this).val();
        $('#pc').val(c);
        $('#myform').submit();

    })
    $('#reset').click(function () {
        $('#name').val('');
        $('#myform').submit();
    })

</script>



{/block}